﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using EnCor.Config;

namespace EnCor.Security
{
    public class AuthenticationExtensionConfigCollection : ConfigurationElementCollection
    {
        //protected override Type RetrieveConfigurationElementType(System.Xml.XmlReader reader)
        //{
        //    Type configurationElementType = null;
        //    if (reader.AttributeCount > 0)
        //    {
        //        // expect the first attribute to be the name
        //        for (bool go = reader.MoveToFirstAttribute(); go; go = reader.MoveToNextAttribute())
        //        {
        //            if (Constants.Config_Type.Equals(reader.Name))
        //            {
        //                configurationElementType = Type.GetType(reader.Value);
        //                if (configurationElementType == null)
        //                {
        //                    throw new ConfigurationErrorsException();
        //                }

        //                break;
        //            }
        //        }

        //        if (configurationElementType == null)
        //        {
        //            throw new ConfigurationErrorsException();
        //        }
        //        // cover the traces
        //        reader.MoveToElement();
        //    }

        //    return configurationElementType;
        //}
        protected override ConfigurationElement CreateNewElement()
        {
            return new AuthenticationExtensionConfig();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((AuthenticationExtensionConfig)element).Name;
        }
    }
}
